package com.usian.feign;

import com.usian.fallback.UserServiceFallback;
import com.usian.pojo.Emp;
import com.usian.pojo.User;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

//获取eureka-provider的调用地址，且具有负载均衡的能力
@FeignClient(value="eureka-provider",fallback = UserServiceFallback.class)
public interface UserFeign {
    @RequestMapping(value="/provider/user")
    public User getUser1();
    @RequestMapping(value ="emp1/{ename}")
    public List<Emp> getempbyename(@PathVariable String ename);
    @RequestMapping("user/{id}")
    public User getUser(@PathVariable Integer id);

    @RequestMapping("/findall")
    public List<Emp> findall();
    @RequestMapping("emp/{id}")
    public Emp getempbyeid(@PathVariable Integer id);
    @RequestMapping("/list/{nums}")
    public int[] findnums(@PathVariable int[] nums);
    @RequestMapping("/user")
    User finduser(@RequestBody User user);
    @RequestMapping("/id")
    Integer findid(@RequestParam int id);
}
